package main

import (
	"fmt"
	"net"
	"os"
)

func main() {
	fmt.Println("server at :8899")
	ip, err := net.ResolveTCPAddr("tcp4", ":8899")
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	ser, err := net.ListenTCP("tcp", ip)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	for {
		conn, err := ser.Accept()
		if err != nil {
			continue
		}
		go handleClient(conn)
	}
}

func handleClient(conn net.Conn) {
	conn.Write([]byte("hello world"))
}
